<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" session="true"%>
    
<!--  main content example start-->
<%@page import="booking.*" %>
<%@ page import="java.sql.*" %>
<div id="main">
    <%! bookUtil ut = new bookUtil();
         ResultSet rs; %>
    
    <%  ut.setDriver(application.getInitParameter("oracle_driver"));
	    ut.setUrl(application.getInitParameter("oracle_db"));
	    ut.setUser(application.getInitParameter("oracledb_user"));
	    ut.setPswd(application.getInitParameter("oracledb_password"));
	    String custId = (String)session.getAttribute("customerid");
	    if(custId == null)
	    {
	        %>
	        <h2>Your Bookings</h2>
	    	<h3>You're not logged in yet.</h3>
	    	<br />
	    	<div class="billing">
	    	<h4>If you already have an account, <a href="login.jsp">login</a>.</h4>
	    	<br/>
	    	<h4>No account? <a href="register.jsp">Register With Us.</a></h4>
	    	</div>
	    <% }
	    else
	    {
	       rs = ut.getDbRecord(custId);%>
	    	
	    			
			<h2>Booking Information</h2>
           <table>
				<tr>
					<th class="first">BookingId</th>
					<th>Description</th>
					<th>Start Date</th>
					<th>End Date</th>
					<th>Destination</th>
				</tr>
				<%while(rs.next()) 
				  {%>
					<tr class='row-odd'>
					<td class="first"> <a href="details.jsp?id=<%= rs.getObject("BookingId")%>"><%= rs.getObject("BookingId") %></a> </td>
					<td><%= rs.getObject("Description") %></td>
					<td><%= rs.getObject("TripStart") %></td>
					<td><%= rs.getObject("TripEnd") %></td>
					<td><%= rs.getObject("Destination") %></td>
				</tr><%} %>
			</table>
			<% }%>
	    					
			
		</div>
<!-- main ends -->	